Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table namespace classifier #761

Merged
merged 1 commit into from Sep 19, 2017

Conversation

ming535
Copy link
Contributor

@ming535 ming535 commented Sep 18, 2017

Add table namespace classifier

"github.com/juju/errors"
)

var tablePrefix = []byte{'t'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seem we must support index prefix later too.

@@ -0,0 +1,46 @@
package server
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use table_namespace_classifier.go , we don't support CamelCase for the file name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please add license header.

@siddontang
Copy link
Contributor

Please add test

for name, ns := range classifier.nsInfo.namespaces {
startTable := core.DecodeTableID(regionInfo.StartKey)
endTable := core.DecodeTableID(regionInfo.EndKey)
for _, tableID := range ns.TableIDs {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have many tables in one namespace, seem this range check will hurt the performance.
Maybe is it better to use a hash map for TableIDs ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok. Because the number of regions may be a lot, now we always try the best to avoid traversing regions.

@@ -0,0 +1,46 @@
package server
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please add license header.

)

type tableNamespaceClassifier struct {
nsInfo *namespacesInfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is namespaceInfo defined? Forget to submit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in another PR #747

Saving/Loading namespace and classifier are separated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is supposed to merge into dantin/namespace

for name, ns := range classifier.nsInfo.namespaces {
startTable := core.DecodeTableID(regionInfo.StartKey)
endTable := core.DecodeTableID(regionInfo.EndKey)
for _, tableID := range ns.TableIDs {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok. Because the number of regions may be a lot, now we always try the best to avoid traversing regions.

@ming535
Copy link
Contributor Author

ming535 commented Sep 19, 2017

@siddontang @disksing merged this PR to dantin/namespace and will add tests in dantin/namespace, so that you can review all the changes in this PR: #747

@ming535 ming535 merged commit 9afaf2d into dantin/namespace Sep 19, 2017
ming535 added a commit that referenced this pull request Sep 20, 2017
@disksing disksing deleted the feature-namespace-classifier branch October 16, 2017 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants